<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>拼多多</title>
    <link rel="stylesheet" type="text/css" href="../css/aui.css">
    <link rel="stylesheet" type="text/css" href="../css/aui-slide.css">
    <link rel="stylesheet" type="text/css" href="../css/taobao.css">
    <link rel="stylesheet" type="text/css" href="../css/index.css" />
    <link rel="stylesheet" type="text/css" href="../css/common.css">
    <style type="text/css">
        .aui-slide-page-active{background: #fff;width: .8rem;border-radius: 3px;}
        .tb_zt_texttit{font-size: 0.7rem;}
        .tb_price{color:#FF175D;font-size: 0.6rem;float: left;}
        .tb_price span{text-decoration:none;color:#FF175D;font-size: 0.9rem;padding-left: 0.2rem;padding-right: 0.2rem;}

        .ta_zt{height: 1.2rem;display: flex;display: -webkit-flex;justify-content: space-between;-webkit-flex:space-between;align-items: center;-webkit-align-items: center;}
        .tb_zt_right{padding: 0.5rem 0;}


        .tb_numbar{color: #999999;font-size: 0.6rem;float: right;}
        .z_bottom{height: 1.2rem}
        .z_bottom dl{float: left;padding: 0.1rem 0.2rem;border-radius: 0.2rem;font-size:0.6rem;margin-right: 0.2rem;}
        .z_bottom dt,.z_bottom dd{float: left;}
        .z_bottom .z_l{background: #FCEAEA;color: #FF175D;}
        .z_bottom .z_r{background: #FFEFCE;color: #FFAD03}
        .z_bottom .z_r dt{border-right: 1px dashed #999999;}
        .z_bottom .z_r dt,.z_bottom .z_r dd{padding-right:0.2rem;}
    </style>
</head>
<body class="bg_fff" id="top">
<div style="height: 40px;"></div>
<div class="bg_img aui-content">
<!-- 顶部end -->
<!-- 标题 -->
<!-- <div class="aui-tab tb_tit_bar" id="tab" style="overflow-x: auto;">
    <div class="aui-tab-item aui-active">女装</div>
    <div class="aui-tab-item">男装</div>
    <div class="aui-tab-item">内衣配饰</div>
    <div class="aui-tab-item">母婴玩具</div>
    <div class="aui-tab-item">美妆个护</div>
    <div class="aui-tab-item">食品保健</div>
    <div class="aui-tab-item">居家生活</div>
    <div class="aui-tab-item">鞋品箱包</div>
    <div class="aui-tab-item">运动户外</div>
    <div class="aui-tab-item">文体车品</div>
    <div class="aui-tab-item">数码家电</div>
</div> -->
<!-- 标题end -->
<!-- banner -->
<!-- <div id="aui-slide3">
    <div class="aui-slide-wrap" >
        <div class="aui-slide-node bg-dark">
            <img src="../image/banner1.png" />
        </div>
        <div class="aui-slide-node bg-dark">
            <img src="../image/banner2.png" />
        </div>
    </div>
    <div class="aui-slide-page-wrap"></div>
</div> -->
<!-- banner end -->
<!-- 主体 -->
<div class="tb_bar">
    <!-- <div class="aui-tab tb_zt_tit" id="tab2">
        <div class="aui-tab-item">最新上架</div>
        <div class="aui-tab-item">福利优惠</div>
        <div class="aui-tab-item">火热促销</div>
    </div> -->
    <div class="tb_zt_con">
        <ul class="aui-list aui-media-list" id="list">
            <!-- <li class="aui-list-item">
                <div class="aui-media-list-item-inner"> <div class="aui-list-item-media"> <img class="goods_img" src="/storage/emulated/0/Android/data/com.apicloud.apploader/cache/disk/thumb/e47f5a94" _src="https://img.alicdn.com/imgextra/i2/3013499366/TB2UcHyk7CWBuNjy0FaXXXUlXXa_!!3013499366.jpg"> </div> <div class="tb_zt_right"> <div class="tb_zt_texttop"> <div class="tb_zt_text"> <div class="tb_zt_texttit aui-ellipsis-2"> 衣橱飘香袋除臭除味衣柜香包防霉防虫</div> </div> </div> <div class="ta_zt"> <div class="tb_price">¥<span>7.90</span>券后</div> <div class="tb_numbar">月销:3549&nbsp;|&nbsp;拼多多</div> </div> <div class="z_bottom"> <dl class="z_l"><dt>赚</dt><dd>￥0.16</dd></dl> <dl class="z_r"><dt>券</dt><dd>￥2.00</dd></dl> </div> </div> </div>
            </li> -->
         </ul>
     </div>

</div>
<!-- banner end -->
</div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/zepto.min.js"></script>
<script type="text/javascript" src="../script/aui-slide.js"></script>
<script type="text/javascript" src="../script/doT.min.js" ></script>
<script type="text/javascript" src="../script/common.js"></script>
<script type="text/javascript">
    var p=0,cid=0;
    apiready = function(){
        api.parseTapmode();
        //下拉刷新
        _Refresh(function(){
            p=0;cid=0;
            getData();
        });;
        //流动监听
        api.addEventListener({
            name:'scrolltobottom',
            extra:{
                threshold:100 //设置距离底部多少距离时触发，默认值为0，数字类型
            }
        }, function(ret, err){
            getData();
        });


        var slide3 = new auiSlide({
        container:document.getElementById("aui-slide3"),
            // "width":300,
            "height":140,
            "speed":500,
            "autoPlay": 3000, //自动播放
            "loop":true,
            "pageShow":true,
            "pageStyle":'dot',
            'dotPosition':'center'
        })
        //类目获取
        get_nav();
        getData();

    }
    function get_nav(){
        var items = [{title: '全部',bg: 'rgba(255,255,255,0)'}];
        _Ajax(window.APIServer.PddOpt,'post','','json',function(ret){
            //.渲染页面
            var section_ids = [0];
            if (ret.code==1) {
                var i=1;
                $(ret.data).each(function(k,v){
                    items.push({title:v.opt_name,bg: 'rgba(255,255,255,0)'});
                    section_ids[i]=v.opt_id;
                    i++;
                });
                _SetPrefs('pdd_opt_ids',JSON.stringify(section_ids));
            }
            NVNavigationBar_open(items);
        });
    }


    function NVNavigationBar_open(items) {
        var NVNavigationBar = api.require('NVNavigationBar');
        NVNavigationBar.open({
            rect: {
                x: 0,
                y: 0,
                w: api.frameWidth,
                h: 40
            },
            styles: {
                orientation: 'horizontal',
                bg: '#fff',
                bgAlpha: 1,
                font: {
                    size: 14,
                    sizeSelected: 16,
                    color: '#333',
                    colorSelected: '#FE417A'
                },
                itemSize: {
                    w: 50,
                    h: 40
                }
            },
            items: items,
            selectedIndex: 0,
            fixedOn: api.frameName,
            fixed: true,
            id: 'pdd_jav'
        }, function(ret, err) {
            if (ret.eventType == 'click') {
                var ids = JSON.parse(_GetPrefs('pdd_opt_ids'));
                p=0;
                cid = ids[ret.index];
                location.href="#top";
                getData();
            }
        });
    }
    function getData(){
        p++;
        _loading2();
        _Ajax(window.APIServer.Search,'post',{values:{tjp:'p',p:p,cid:cid}},'json',function(ret){
            _loading2_close();
            //.渲染页面
            if (ret.code==1) {
                var evalText = doT.template($api.text($api.byId('goodslist')));
                if (p==1) {
                    $api.html($api.byId('list'), evalText(ret.data));
                }else{
                    $api.append($api.byId('list'), evalText(ret.data));
                }
               imageCache('.goods_img');
            }else{
                p--;
                $('.loading-1').remove();
                $('body').append('<div class="loading-1">'+ret.msg+'</div>');
            }

        })
    }
</script>
<script id="goodslist" type="text/x-dot-template">
    {{ for (key in it.data){ }}
    <li class="aui-list-item" onclick='open_goods({{= JSON.stringify(it['data'][key]) }})' tapmode>
        <div class="aui-media-list-item-inner">
            <div class="aui-list-item-media">
                <img class="goods_img" src="../image/faleimg.gif" _src="{{= it['data'][key]['pic'] }}">
            </div>
            <div class="tb_zt_right">
                <div class="tb_zt_texttop">
                    <div class="tb_zt_text">
                        <div class="tb_zt_texttit aui-ellipsis-2"> {{= it['data'][key]['short_title'] }}</div>
                    </div>
                </div>
                <div class="ta_zt"> <div class="tb_price">¥<span>{{= it['data'][key]['price_after_quan'] }}</span>券后</div> <div class="tb_numbar">月销:{{= it['data'][key]['sales'] }}&nbsp;|&nbsp;拼多多</div> </div> <div class="z_bottom"> <dl class="z_l"><dt>赚</dt><dd>￥{{= it['data'][key]['earn_yg'] }}</dd></dl> <dl class="z_r"><dt>券</dt><dd>￥{{= it['data'][key]['quan_price'] }}</dd></dl> </div> </div> </div>
            </div>
        </div>
    </li>
    {{ } }}
</script>
</html>
